Repository navigation
Only enable host check if you use proxy, and add a way to opt out of it - #2288
Merged
Merged
Conversation
gaearon
force-pushed
the
disable-host-check
branch
from
May 20, 2017 16:27
90ceaa3 to
b54373d
Compare
This was referenced May 20, 2017
commented
May 20, 2017
Contributor
Author
|
Any chance you could take a glance at this? I know it’s not perfect, but the alternative is that people just "eject" from Create React App to modify their configs, at which point they're just as unsafe. So while this doesn't quite solve the |
Timer
approved these changes
May 20, 2017
commented
May 24, 2017
|
Hi! This looks like a good compromise - great idea :-) |
commented
May 24, 2017
Contributor
Author
|
@edmorley Thanks for checking! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The newly added host check (webpack/webpack-dev-server#887, explanation) is significantly disruptive to people’s workflows (#2271, #2233), especially in legit use cases like cloud editors (#2271 (comment)).
I think only enabling the host check for
proxyusers is a reasonable compromise because unlike WDS, we only serve files inpublicfolder by default which the user has consented to... being public. Of course, withproxyenabled this is still dangerous, so we enable the host check in this case.For people who use
proxywith a non-localhostdevelopment server, we recommend specifying theHOSTin.env.developmentfile. It gets passed as thepublicoption to WDS. This solves the problem nicely for most remaining cases.Finally, this adds a way to completely opt out of the host checks by adding
DANGEROUSLY_DISABLE_HOST_CHECK=trueto.env.development.localin case you are not worried about attacks (which could be the case if you’re using a cloud editor and don’t have sensitive data) and just can’t get it to work otherwise.